package com.example.cofeed.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.cofeed.R;
import com.example.cofeed.entity.Attention;

import java.util.List;

public class AttentionLeftAdapter extends BaseQuickAdapter<Attention, BaseViewHolder> {
    public AttentionLeftAdapter() {
        super(R.layout.adapter_attention_left);
    }

    @Override
    protected void convert(BaseViewHolder helper, Attention item) {

        helper.setText(R.id.tv_name, item.title);
        if (item.isSelect){
            helper.setTextColor(R.id.tv_name, mContext.getResources().getColor(R.color.colorAccent));
        }else {
            helper.setTextColor(R.id.tv_name, mContext.getResources().getColor(R.color.colorGray));
        }
    }

    public void setSelect(Attention select){
        for (Attention attention:getData()){
            attention.isSelect = false;
        }
        select.isSelect = true;
        notifyDataSetChanged();

    }
}
